package unimelb.discussiontracker.twitter.data.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "Tweet")
public class TweetEntity {
    @Id
    @Column(name = "Id")
    private long id;

    @Column(name = "Text")
    private String text;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "CreatedDate")
    private Date createdDate;

    @OneToMany(mappedBy = "tweet", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    private List<TweetHashTagAssociation> hashTags;

    @OneToMany(mappedBy = "tweet", cascade = CascadeType.ALL)
    private List<TweetUserAssociation> mentionedUsers;

    @ManyToOne
    @JoinColumn(name = "OwnerId")
    private UserEntity owner;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public List<TweetHashTagAssociation> getHashTags() {
        return hashTags;
    }

    public void setHashTags(List<TweetHashTagAssociation> hashTags) {
        this.hashTags = hashTags;
    }

    public List<TweetUserAssociation> getMentionedUsers() {
        return mentionedUsers;
    }

    public void setMentionedUsers(List<TweetUserAssociation> mentionedUsers) {
        this.mentionedUsers = mentionedUsers;
    }

    public UserEntity getOwner() {
        return owner;
    }

    public void setOwner(UserEntity owner) {
        this.owner = owner;
    }

}
